package com.skillworld.webapp.model.userservice;

import java.util.List;
import java.util.Set;

import com.skillworld.webapp.model.team.Team;
import com.skillworld.webapp.model.user.User;
import com.skillworld.webapp.model.util.InvalidArgumentException;
import com.skillworld.webapp.model.util.PermissionDeniedException;

import es.udc.pojo.modelutil.exceptions.InstanceNotFoundException;

public interface UserService
{
	public User registerFacebookUser(String facebookId, String authorizationToken, 
	                                    String nickname, String skilly, String picture)
	        throws AlreadyRegisteredException, NicknameAlreadyInUseException,
	                InvalidFacebookTokenException;
	public User facebookUserLogin(String facebookId, String authorizationToken)
	        throws InvalidFacebookTokenException, InstanceNotFoundException;
	public User findUserProfile(Long userId)
	        throws InstanceNotFoundException;
	public void updateUserProfile(Long userId, String newNickname, 
	                                String newSkilly, String newPicture)
	        throws InstanceNotFoundException, NicknameAlreadyInUseException;
	public List<User> findUsers(String nickPrefix, Long inTeam, 
	                            Long notInTeam, List<Long> exclude, 
	                            int startIndex, int count)
	        throws InvalidArgumentException;
	public int numberOfUsers(String nickPrefix, 
	                Long inTeam, Long notInTeam, List<Long> exclude);
	public List<User> topUsers(int count)
	        throws InvalidArgumentException;
	public Team createTeam(String name, String info, String image, long leaderId, List<Long> deptIds)
	        throws InstanceNotFoundException, TeamNameAlreadyInUseException, InvalidArgumentException;
	public Team findTeam(Long teamId) throws InstanceNotFoundException;
	public List<Team> findUserTeams(long userId) throws InstanceNotFoundException;
    public List<Team> searchTeams(String query, int startIndex, int count);
    public int numberOfTeams(String query);
	public void updateTeamProfile(Long teamId, Long userId, 
	                    String newName, String newInfo, String newImage)
	        throws InstanceNotFoundException, PermissionDeniedException, 
	                TeamNameAlreadyInUseException;
	//public removeTeam(long teamId, long userId) throws InstanceNotFoundException, PermissionDeniedException;
	public void inviteToJoinTeam(long teamId, long inviterId, long inviteeId) 
	        throws InstanceNotFoundException, PermissionDeniedException,
	                AlreadyTeamMemberException;
    public void inviteToJoinTeam(long teamId, long inviterId, List<Long> inviteeIds) 
            throws InstanceNotFoundException, PermissionDeniedException,
                    AlreadyTeamMemberException;
	public void removeFromTeam(long teamId, long leaderId, long memberId) 
	    throws InstanceNotFoundException, PermissionDeniedException, 
	                NotTeamMemberException;
    public void removeFromTeam(long teamId, long leaderId, List<Long> memberIds) 
        throws InstanceNotFoundException, PermissionDeniedException, 
                    NotTeamMemberException;
	public void leaveTeam(Long teamId, Long userId)
	        throws InstanceNotFoundException, PermissionDeniedException,
	                NotTeamMemberException;
	public List<Team> topTeams(int count)
	        throws InvalidArgumentException;
}
